package com.assets.room.dao;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;

import com.assets.room.entity.Place;

import java.util.List;

@Dao
public interface PlaceDao {

    @Insert
    void insertPlace(Place place);

    @Insert
    void insertPlace(List<Place> place);


    @Query("DELETE FROM t_info_place")
    void deleteAllData();

    @Query("SELECT * FROM t_info_place")
    List<Place> getAllPlace();

    @Query("SELECT name FROM t_info_place WHERE id = :id")
    String getNameById(String id);

    @Query("SELECT name FROM t_info_place WHERE pid = :pid")
    String getNameByPid(String pid);

    @Query("SELECT * FROM t_info_place WHERE id = :id")
    Place getAllById(String id);

    @Query("SELECT MAX(id) FROM t_info_place")
    String getMaxId();

    @Query("SELECT * FROM t_info_place WHERE name = :name")
    Place getAllByName(String name);

    @Query("SELECT * FROM t_info_place WHERE pid = :pid")
    List<Place> getAllByPid(String pid);

    @Query("SELECT * FROM t_info_place WHERE pid = :pid")
    Place getAllByPids(String pid);

    @Query("SELECT * FROM t_info_place WHERE is_flag = :is_flag")
    List<Place> getAllByFlag(String is_flag);

}
